//
//  LocalCreator.m
//  Futbol5Final
//
//  Created by Johan Chaves on 4/14/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "LocalCreator.h"
#import "DistritosVO.h"
#import "LocalVO.h"

@implementation LocalCreator

-(NSMutableArray *) createLocales:(DistritosVO*)pdistrito :(NSDictionary *)localesData{
    NSMutableArray * localesResult = [[NSMutableArray alloc]init];
    
    LocalVO *localVoTmp;
    
    NSMutableDictionary *localTmp = [[NSMutableDictionary alloc]init];
    
    NSString *ids;
    
    NSEnumerator *arrenum = [localesData objectEnumerator];
    id cobj;   
    
    while ( cobj = [arrenum nextObject] ) {
        
        [localTmp setDictionary:cobj];
        ids = [localTmp objectForKey:@"id_local"];
        
        localVoTmp = [[LocalVO alloc]initWithData: pdistrito:[localTmp objectForKey:@"canchas"]:[localTmp objectForKey:@"nombre"] :[localTmp objectForKey:@"direccion_exacta"]:UITableViewCellStyleDefault :[ids intValue] reuseIdentifier:@"local"];            
        
        [localesResult addObject:localVoTmp];
        
        [localVoTmp release];
        [ids release];
        
    }
    
    [localTmp release];
    [cobj release];
    
    return localesResult;
}

@end
